cmake_minimum_required(VERSION 3.10)

set(BASE_LATER_FILES

psstream/PS2ES.cpp
psstream/PS2ES.h
psstream/ps_parse.cpp
psstream/ps_parse.h
psstream/PSPacket.h
psstream/streamdef.h
)

option(WITH_X264 "with x264" OFF)
option(WITH_X265 "with x265" OFF)

if (WITH_X264)
        add_definitions(-DWITH_X264)
        set(X264_FILES
                h264.cpp
                h264.h
                h264_parse.cpp
                encoder.c
        )
endif ()
if (WITH_X265)
        add_definitions(-DWITH_X265)
        set(X265_FILES
                enc_h265.c
                enc_h265.h
        )
endif ()

set(BASE_FILES
        base.h
        cmyuv.c
        cmyuv.h
        codec.c
        codec.h
        vlc_bits.h
        ${X264_FILES}
        ${X265_FILES}
        )

add_library(cm-codec STATIC ${BASE_FILES})

add_executable(cmyuvtools
        ${BASE_FILES}
        cmyuvtools.c
        )

add_executable(cmcodec
        ${BASE_FILES}
        cmcodec.c
)